package com.sunl.mall.ali.mq.model;

import java.io.Serializable;

/**
 * 发送的消息体，不同于 RocketMqMessageWrapper，他只是用来将消息体和一些其他数据包装成sdk的Message
 *
 * @param <T>
 */
public class RocketMqMessageBody<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 业务ID（可以做幂等key）
     */
    private String businessId;

    /**
     * 消息内容
     */
    private T content;

    public RocketMqMessageBody() {
    }

    public RocketMqMessageBody(T content) {
        this.content = content;
    }

    public RocketMqMessageBody(T content, String businessId) {
        this.content = content;
        this.businessId = businessId;
    }

    public static <T> RocketMqMessageBody<T> getInstance(T content) {
        return new RocketMqMessageBody<>(content);
    }

    public static <T> RocketMqMessageBody<T> getInstance(T content, String businessId) {
        return new RocketMqMessageBody<>(content, businessId);
    }

    public String getBusinessId() {
        return businessId;
    }

    public void setBusinessId(String businessId) {
        this.businessId = businessId;
    }

    public T getContent() {
        return content;
    }

    public void setContent(T content) {
        this.content = content;
    }
}